package com.tannm.doan.taskmanager.database;

//TaskData class
public class DataRowAlarm extends DataRow {
	// Table field indexes for field select speedup
	public static class fid {
		public static final int ID = 0;
		public static final int Type = 1;
		public static final int RefID = 2;
		public static final int ActionClear = 3;
		public static final int ActionSnooze = 4;
		public static final int SnoozeCount = 5;
	};

	// Table definition
	private final DataField[] tableDef = {
			new DataField(fid.ID, "_ID", DataField.Type.INT, true, true),
			new DataField(fid.Type, "Type", DataField.Type.TEXT, true, false),
			new DataField(fid.RefID, "RefID", DataField.Type.INT, true, false),
			new DataField(fid.ActionClear, "ActionClear", DataField.Type.INT,
					true, false),
			new DataField(fid.ActionSnooze, "ActionSnooze", DataField.Type.INT,
					true, false),
			new DataField(fid.SnoozeCount, "ActionSnoozeCount",
					DataField.Type.INT, true, false), };

	// fields
	public long lType = 0;
	public long lRefID = 0;
	public long lActionClear = 0;
	public long lActionSnooze = 0;
	public long lSnoozeCount = 0;

	// methods
	public DataRowAlarm(Database userdb) {
		super(userdb);
		setTableDefinition(tableDef);
	}

	// methods
	@Override
	public String toString() {
		return "";
	}

	@Override
	public boolean validate() {
		return true;
	}

	@Override
	public void setValuesForDataRow() {
		clearContentValues();

		value(fid.Type).set(lType);
		value(fid.RefID).set(lRefID);
		value(fid.ActionClear).set(lActionClear);
		value(fid.ActionSnooze).set(lActionSnooze);
		value(fid.SnoozeCount).set(lSnoozeCount);
	}

	@Override
	public void getValuesFromDataRow() {
		lType = value(fid.Type).asLong();
		lRefID = value(fid.RefID).asLong();
		lActionClear = value(fid.ActionClear).asLong();
		lActionSnooze = value(fid.ActionSnooze).asLong();
		lSnoozeCount = value(fid.SnoozeCount).asLong();
	}

	@Override
	public String getTableName() {
		return Database.sTableNameAlarms;
	}

}
